#!/bin/sh
# Load functions and variables
. /usr/bin/common
export NEWT_COLORS='root=,black border=white,black window=white,black title=white,black textbox=white,black listbox=white,black'

whiptail_height="$(($(tput lines) - 6))"
whiptail_width="$(($(tput cols) - 20))"

while true; do
  CHOICE="$(whiptail --nocancel --title "Odysseyn1x $ODYSSEYN1X_VERSION" --menu '' $whiptail_height $whiptail_width 7 \
    '1' 'Checkra1n' \
    '2' 'Odysseyra1n' \
    '3' 'Project Sandcastle' \
    '4' 'SSH' \
    '5' 'Shell' \
    '6' 'Shut down' \
    '7' 'Reboot' 3>&1 1>&2 2>&3)"
  case "$CHOICE" in
    1)
      clear
      /usr/bin/checkra1n
      ;;
    2)
      clear
      /usr/bin/odysseyra1n
      ;;
    3)
      /usr/bin/projectsandcastle_menu
      ;;
    4)
      clear
      /usr/bin/ssh_into_ios
      ;;
    5)
      clear
      break
      ;;
    6)
      odysseyn1x_logo
      sleep 2
      /usr/sbin/shutdown now
      ;;
    7)
      odysseyn1x_logo
      sleep 2
      /usr/sbin/reboot
      ;;
  esac
done
